package cn.gjculture.shopping.api.controller;


import cn.gjculture.shopping.api.entity.ArtistVote;
import cn.gjculture.shopping.api.entity.PageInfo;
import cn.gjculture.shopping.api.entity.Return;
import cn.gjculture.shopping.api.service.ArtistVoteService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping(value = "/artistVote")
public class ArtistVoteController {

    @Autowired
    ArtistVoteService artistVoteService;

    @ApiOperation(value = "新增艺术家投票", notes = "新增术分类")
    @ApiImplicitParam(name = "artistVote", value = "术分类对象", required = true, dataType = "Object")
    @PostMapping
    public Return save(ArtistVote artistVote) {
        Return ret = new Return();
        if(artistVoteService.insert(artistVote,ret)>0){
            ret.getCommon().setRet(true);
        }
        return ret;
    }

    @ApiOperation(value = "获取艺术家投票列表", notes = "获取艺术家投票列表")
    @GetMapping
    public Return<List<ArtistVote>> query(PageInfo pageInfo) {
        Return<List<ArtistVote>> ret = new Return<>();
        List<ArtistVote> artistVotes = artistVoteService.query();
        ret.setData(artistVotes);
        return ret;
    }




}
